package org.huawei260.TiKu.ODsuanfa;

import java.util.Arrays;
import java.util.StringJoiner;

/**
 * @Author: qingle
 * @Date: 2024/10/28-16:11
 * @Description: 2558 【排序】2024D机场航班调度程序
 * @version: 1.0
 */
import java.util.Arrays;
import java.util.Scanner;
import java.util.StringJoiner;
public class D_2024D_2558__排序机场航班调度程序 {

//	public class Main {
		public static void main(String[] args) {
			Scanner sc = new Scanner(System.in);

			String[] flights = sc.nextLine().split(",");

			StringJoiner sj = new StringJoiner(",");
			Arrays.stream(flights)
				.sorted(
					(a, b) -> {
						String abbr1 = a.substring(0, 2);
						String num1 = a.substring(2);

						String abbr2 = b.substring(0, 2);
						String num2 = b.substring(2);

						if (abbr1.equals(abbr2)) {
							return num1.compareTo(num2);
						} else {
							return abbr1.compareTo(abbr2);
						}
					})
				.forEach(sj::add);

			System.out.println(sj);
		}
	}